import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import 'amfe-flexible';
import Vant from 'vant';
import 'vant/lib/index.css';
import  "./assets/iconfont.css";
import 'animate.css';

Vue.use(Vant);

Vue.config.productionTip = false
Vue.component("my-btn",{
  render:function(c){
    return c("div","你好")
  }
})
Vue.directive("move",{
  bind: function (el) {
    el.onmousedown = function (e) {
      let offsetX = e.offsetX;
      let offsetY = e.offsetY;
      //相对位置
      console.log(offsetX);

      document.onmousemove = function (e1) {
       
        
        let clientX = e1.clientX;
        let clinetY = e1.clientY;
        //鼠标距离屏幕的位置
        console.log(clientX);

        let x = clientX - offsetX;
        let y = clinetY - offsetY;

        el.style.left = x + "px";
        el.style.top = y + "px";
      };
      document.onmouseup  = function(){
        document.onmousemove  = null;
       
      }
    }
  }
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
